package com.yujinglin.maxmin;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MaxMinWritable implements Writable {
    private double min;
    private  double max;

    public  MaxMinWritable(){

    }

    public  MaxMinWritable(double p_max, double p_min){
        max=p_max;
        min= p_min;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeDouble(max);
        out.writeDouble(min);

    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.max = in.readDouble();
        this.min= in.readDouble();
    }

    @Override
    public String toString() {
       return  max + "\t" + min;
    }

    public double getMin() {
        return min;
    }

    public void setMin(long min) {
        this.min = min;
    }

    public double getMax() {
        return max;
    }

    public void setMax(long max) {
        this.max = max;
    }
}
